import $user from '@/api/modules/user';
import { defineStore } from 'pinia';

type UserInfo = {
  CreatedAt: string,
  DeletedAt: string | null,
  Encrypt: string,
  ID: number,
  LoginName: string,
  Password: string,
  UpdatedAt: string,
}
let userInfo: UserInfo;

export default defineStore('user', {
  state: () => ({
    userInfo,
  }),
  actions: {
    async getUserInfo() {
      const { data } = await $user.getUserInfo();
      this.userInfo = data.data;
      return this.userInfo;
    },
  },
});
